# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Maintainer: Massimo Callegari <support@qlcplus.org>

# The Qt5 GIT repository to clone from
_qt_git_repo=https://code.qt.io/qt
#_qt_git_repo=https://github.com/qtproject

# The Qt5 GIT branch to clone and build (replace with 'dev' to build the bleeding edge sources)
_qt_git_branch=5.7

# The way Qt5 libraries are built. Possible values are '-release', '-debug' or '-debug_and_release'
_build_mode=-release

# The package target installation path
_qt5_prefix="${MINGW_PREFIX}"

# Tune the following to decide how and what to build
_with_icu=yes
_with_fontconfig=yes
_with_openssl=yes
_with_dbus=yes
_system_freetype=yes
_system_zlib=yes
_system_pcre=yes
_system_libpng=yes
_system_libjpeg=yes
_system_harfbuzz=yes
_build_examples=yes
_build_tools=yes
_build_tests=yes
_make_docs=yes

# Set the way opengl should be compiled. Possible values are 'angle', 'desktop' or 'dynamic'
_opengl=desktop
_opengl_for_configure="${_opengl}"

# Getting crashes that only happen in release builds?
# Define this and you may have a hope of figuring out why ..
_debuggable_release=no

_basename=qt5
pkgbase=mingw-w64-${_basename}-git
pkgname="${MINGW_PACKAGE_PREFIX}-${_basename}-git"
_ver_base=5.7.0
pkgver=5.7.0.1.d9beab9
pkgrel=1
arch=('any')
url='https://www.qt.io/'
install=qt5.install
license=('GPL3' 'LGPL' 'FDL' 'custom')
provides=("${MINGW_PACKAGE_PREFIX}-${_basename}")
conflicts=("${MINGW_PACKAGE_PREFIX}-${_basename}")

depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
         "${MINGW_PACKAGE_PREFIX}-qtbinpatcher"
         $([[ "$_with_dbus" == "yes" ]] && echo "${MINGW_PACKAGE_PREFIX}-dbus")
         $([[ "$_with_fontconfig" == "yes" ]] && echo "${MINGW_PACKAGE_PREFIX}-fontconfig")
         $([[ "$_system_freetype" == "yes" ]] && echo "${MINGW_PACKAGE_PREFIX}-freetype")
         $([[ "$_system_harfbuzz" == "yes" ]] && echo "${MINGW_PACKAGE_PREFIX}-harfbuzz")
         "${MINGW_PACKAGE_PREFIX}-jasper"
         $([[ "$_system_libjpeg" == "yes" ]] && echo "${MINGW_PACKAGE_PREFIX}-libjpeg")
         "${MINGW_PACKAGE_PREFIX}-libmng"
         $([[ "$_system_libpng" == "yes" ]] && echo "${MINGW_PACKAGE_PREFIX}-libpng")
         "${MINGW_PACKAGE_PREFIX}-libtiff"
         "${MINGW_PACKAGE_PREFIX}-libxml2"
         "${MINGW_PACKAGE_PREFIX}-libxslt"
         "${MINGW_PACKAGE_PREFIX}-libwebp"
         $([[ "$_with_openssl" == "yes" ]] && echo "${MINGW_PACKAGE_PREFIX}-openssl")
         $([[ "$_system_pcre" == "yes" ]] && echo "${MINGW_PACKAGE_PREFIX}-pcre")
         "${MINGW_PACKAGE_PREFIX}-sqlite3"
         "${MINGW_PACKAGE_PREFIX}-xpm-nox"
         $([[ "$_system_zlib" == "yes" ]] && echo "${MINGW_PACKAGE_PREFIX}-zlib")
         $([[ "$_with_icu" == "yes" ]] && echo \
            "${MINGW_PACKAGE_PREFIX}-icu" \
            "${MINGW_PACKAGE_PREFIX}-icu-debug-libs" )
        )

makedepends=("git"
             "diffutils"
             "gperf"
             "m4"
             "make"
             "patch"
             "perl"
             "${MINGW_PACKAGE_PREFIX}-ruby"
             "${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             "${MINGW_PACKAGE_PREFIX}-python2"
             "${MINGW_PACKAGE_PREFIX}-make"
             "${MINGW_PACKAGE_PREFIX}-libmariadbclient"
             "${MINGW_PACKAGE_PREFIX}-firebird2"
             "${MINGW_PACKAGE_PREFIX}-postgresql"
            )

groups=("${MINGW_PACKAGE_PREFIX}-qt" "${MINGW_PACKAGE_PREFIX}-qt5")
options=('!strip' 'staticlibs')
qt_modules=(
	qt5
	qt3d
	qtactiveqt
	qtandroidextras
	qtbase
	qtcanvas3d
	qtcharts
	qtconnectivity
	qtdatavis3d
	qtdeclarative
	qtdoc
	qtenginio
	qtgamepad
	qtgraphicaleffects
	qtimageformats
	qtlocation
	qtmacextras
	qtmultimedia
	qtpurchasing
	qtquick1
	qtquickcontrols
	qtquickcontrols2
	qtscript
	qtscxml
	qtsensors
	qtserialbus
	qtserialport
	qtsvg
	qttools
	qttranslations
	qtvirtualkeyboard
	qtwebchannel
	qtwebsockets
	qtwinextras
	qtx11extras
	qtxmlpatterns
    )

source=(
	0001-oracle-driver-prompt.patch
	0002-use-fbclient-instead-of-gds32.patch
	0003-use-mingw-built-mysql-library.patch
	0005-syncqt-fix.patch
	0006-win_flex-replace.patch
	0007-win32-g-Enable-static-builds.patch
	0008-win32-g-Add-QMAKE_EXTENSION_IMPORTLIB-defaulting-to-.patch
	0011-win32-g++-allow-static-dbus-1.patch
	0012-compileTest-for-icu-after-setting-static-or-shared.patch
	0014-fix-configure-tests.patch
	0015-properly-split-libraries-mingw.patch
	0016-win32-g++-use-qpa-genericunixfontdatabase.patch
	0017-fix-examples-building.patch
	0024-icu-add-U_LIB_SUFFIX_C_NAME.patch
	0025-force-using-make-on-msys.patch
	0030-workaround-ansidecl-h-PTR-define-conflict.patch
	0031-workaround-BOOL-define-conflict.patch
	0034-Use-QMAKE_PREFIX_STATICLIB-in-create_cmake-prf.patch
	0035-dont-add-resource-files-to-qmake-libs.patch
	0036-win32-qt5-static-cmake-link-ws2_32-and--static.patch
	0037-Improve-cmake-plugin-detection-as-not-all-are-suffixed-Plugin.patch
	0038-cmake-Rearrange-STATIC-vs-INTERFACE-targets.patch
	0039-Make-it-possible-to-use-static-builds-of-Qt-with-CMa.patch
	0040-Generate-separated-libraries-in-prl-files-for-CMake.patch
	0041-Fix-mingw-create_cmake-prl-file-has-no-lib-prefix.patch
	0042-static-cmake-also-link-plugins-and-plugin-deps.patch
	0043-static-cmake-regex-QT_INSTALL_LIBS-in-QMAKE_PRL_LIBS_FOR_CMAKE.patch
	0045-static-use-qminimal-platform-plugin-for-qcollectiongenerator.patch
	0046-Revert-Revert-fix-NTFS-mount-points.patch
	0048-win32-Avoid-platformNativeInterface-segfaults-with-minimal-platform.patch
	0049-do-not-include-qopengles2ext-h.patch
	)

pkgver() {
  cd "$srcdir/$_basename"
  printf "%s.%s.%s" "$_ver_base" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

# Thiago's patch doesn't contain the configure script changes
# needed, you may be able to get somewhere with this in the
# meantime (probably not though!)
if [ "${_ltcg}" = "yes" ]; then
   LTCG_CFLAGS="-flto-partition=1to1 -flto -ffat-lto-objects"
   LTCG_LFLAGS="-flto-partition=1to1 -flto -ffat-lto-objects"
fi

# Translates using cygpath according to the ${_make} being used
# (so either mingw32-make or MSYS2 make can be used)
path_conv_for_make() {
  if [ "${_make}" = "mingw32-make" ]; then
    echo -n "${1}" | sed "s|${MINGW_PREFIX}|$(cygpath -m ${MINGW_PREFIX})|g"
  else # MSYS2 make
    MINGW_PREFIX_W=$(cygpath -m ${MINGW_PREFIX})
    echo -n "${1}" | sed "s|${MINGW_PREFIX_W}|$(cygpath -u ${MINGW_PREFIX})|g"
  fi
}

# Runs pkg-config with all arguments, then calls path_conv_for_make on each
# result and then adds delimiter between -I/-L/-l and path - both configure
# and configure.bat prefer this. Results returned as an array.
pkg_config_qt5() {
  local _res=$(pkg-config $*)
  local -a _final=()
  for _part in $(path_conv_for_make "${_res}"); do
      _final+=($(echo -n "${_part}" | sed "s|-\([ILl]\)\(.*\)|-\1|g"))
      _final+=($(echo -n "${_part}" | sed "s|-\([ILl]\)\(.*\)|\2|g"))
  done
  echo "${_final[@]}"
}

prepare() {
  cd ${srcdir}

  for submodule in ${qt_modules[@]}; do
	if [ ! -f $submodule/.cloned ]; then
		if [ -f ${submodule}.tar.gz ]; then
			echo "Using ${submodule}.tar.gz archive instead of cloning..."
			tar xzf ${submodule}.tar.gz
		else
			echo "git clone --depth 1 --branch "$_qt_git_branch" "$_qt_git_repo"/${submodule}.git"
			git clone --depth 1 --branch "$_qt_git_branch" "$_qt_git_repo"/${submodule}.git
			touch $submodule/.cloned
			tar czf ${submodule}.tar.gz ${submodule}
		fi
	else
		echo "${submodule} already cloned. Skipping..."
	fi
    if [[ $submodule == ${_basename} ]]; then     
	  cd ${_basename}
    fi
  done
  
  # MSYS2 gperf cannot handle \r\n.
  find . -name "*.gperf" -exec dos2unix "{}" \;

  patch -p1 -i ${srcdir}/0001-oracle-driver-prompt.patch
  patch -p1 -i ${srcdir}/0002-use-fbclient-instead-of-gds32.patch
  patch -p1 -i ${srcdir}/0003-use-mingw-built-mysql-library.patch
  patch -p1 -i ${srcdir}/0005-syncqt-fix.patch
  patch -p1 -i ${srcdir}/0006-win_flex-replace.patch
  
  # Some patches are against qtbase's repository.
  pushd qtbase > /dev/null
    patch -p1 -i ${srcdir}/0007-win32-g-Enable-static-builds.patch
    patch -p1 -i ${srcdir}/0008-win32-g-Add-QMAKE_EXTENSION_IMPORTLIB-defaulting-to-.patch
    patch -p1 -i ${srcdir}/0011-win32-g++-allow-static-dbus-1.patch
    # The next patch needs some work. It's moving a block of shell script un-necessarily
    # as the bit: QMAKE_CONFIG="$QMAKE_CONFIG static" before calling compileTest is what
    # actually made it work. There may be a good reason for not adding static to QMAKE_CONFIG
    # so it might be necessary to back up the value, do compileTest then restore it after.
    patch -p1 -i ${srcdir}/0012-compileTest-for-icu-after-setting-static-or-shared.patch
  popd > /dev/null
  
  patch -p1 -i ${srcdir}/0014-fix-configure-tests.patch
  patch -p1 -i ${srcdir}/0015-properly-split-libraries-mingw.patch
  patch -p1 -i ${srcdir}/0016-win32-g++-use-qpa-genericunixfontdatabase.patch
  patch -p1 -i ${srcdir}/0017-fix-examples-building.patch
  
  patch -p1 -i ${srcdir}/0024-icu-add-U_LIB_SUFFIX_C_NAME.patch
  patch -p1 -i ${srcdir}/0025-force-using-make-on-msys.patch
  
  pushd qtbase > /dev/null
    patch -p1 -i ${srcdir}/0030-workaround-ansidecl-h-PTR-define-conflict.patch
  popd

  patch -p1 -i ${srcdir}/0031-workaround-BOOL-define-conflict.patch

  # See discussion at https://bugreports.qt-project.org/browse/QTBUG-41292
  # I think what is possibly happening instead is that the Debug and Release
  # builds are happening in parallel and this causes the error. While Ossi's
  # suggestion (below) doesn't fix the problem entirely, it makes the chances
  # of it happening near 0.  His take on it is that we should have different
  # target files for RegExpJitTables.h for each of release and debug.
  patch -p1 -i ${srcdir}/0034-Use-QMAKE_PREFIX_STATICLIB-in-create_cmake-prf.patch
  patch -p1 -i ${srcdir}/0035-dont-add-resource-files-to-qmake-libs.patch

  # Patches so that qt5-static can be used with cmake.
  patch -p1 -i ${srcdir}/0036-win32-qt5-static-cmake-link-ws2_32-and--static.patch
  patch -p1 -i ${srcdir}/0037-Improve-cmake-plugin-detection-as-not-all-are-suffixed-Plugin.patch

  pushd qtbase > /dev/null
    patch -p1 -i ${srcdir}/0038-cmake-Rearrange-STATIC-vs-INTERFACE-targets.patch
  popd

  patch -p1 -i ${srcdir}/0039-Make-it-possible-to-use-static-builds-of-Qt-with-CMa.patch
  patch -p1 -i ${srcdir}/0040-Generate-separated-libraries-in-prl-files-for-CMake.patch
  patch -p1 -i ${srcdir}/0041-Fix-mingw-create_cmake-prl-file-has-no-lib-prefix.patch
  patch -p1 -i ${srcdir}/0042-static-cmake-also-link-plugins-and-plugin-deps.patch
  patch -p1 -i ${srcdir}/0043-static-cmake-regex-QT_INSTALL_LIBS-in-QMAKE_PRL_LIBS_FOR_CMAKE.patch

  # More odds and sods.
  patch -p1 -i ${srcdir}/0045-static-use-qminimal-platform-plugin-for-qcollectiongenerator.patch

  pushd qtbase > /dev/null
    patch -p1 -i ${srcdir}/0046-Revert-Revert-fix-NTFS-mount-points.patch
    patch -p1 -i ${srcdir}/0049-do-not-include-qopengles2ext-h.patch
  popd > /dev/null
  rm -f ${srcdir}/qt5/qtbase/src/gui/opengl/qopengles2ext.h

  patch -p1 -i ${srcdir}/0048-win32-Avoid-platformNativeInterface-segfaults-with-minimal-platform.patch

  local _ARCH_TUNE=
  case ${MINGW_CHOST} in
    i686*)
      _ARCH_TUNE="-march=i686 -mtune=core2"
    ;;
    x86_64*)
      _ARCH_TUNE="-march=nocona -mtune=core2"
    ;;
  esac

  if [ "${_debuggable_release}" = "yes" ]; then
    QMAKE_LFLAGS_RELEASE=
    OPTIM_O=${OPTIM_O}" -g"
  else
    QMAKE_LFLAGS_RELEASE="-Wl,-s"
  fi

  BIGOBJ_FLAGS="-Wa,-mbig-obj"

  # Append these ones ..
  sed -i "s|^QMAKE_CFLAGS .*= \(.*\)$|QMAKE_CFLAGS            = \1 ${_ARCH_TUNE} ${BIGOBJ_FLAGS} ${LTCG_CFLAGS}|g" qtbase/mkspecs/win32-g++/qmake.conf
  if [ -n "$OPTIM_D" ]; then
    sed -i "s|^QMAKE_CFLAGS_DEBUG .*= \(.*\)$|QMAKE_CFLAGS_DEBUG      = \1 ${OPTIM_D}|g" qtbase/mkspecs/win32-g++/qmake.conf
  fi
  if [ -n "$OPTIM_O" ]; then
    sed -i "s|^QMAKE_CFLAGS_RELEASE .*= \(.*\)$|QMAKE_CFLAGS_RELEASE    = \1 ${OPTIM_O}|g" qtbase/mkspecs/win32-g++/qmake.conf
  fi
  sed -i "s|^QMAKE_LFLAGS            =\(.*\)$|QMAKE_LFLAGS            = \1 ${LTCG_LFLAGS}|g" qtbase/mkspecs/win32-g++/qmake.conf
  # But overwrite this one.
  sed -i "s|^QMAKE_LFLAGS_RELEASE .*= \(.*\)$|QMAKE_LFLAGS_RELEASE    = ${QMAKE_LFLAGS_RELEASE}|g" qtbase/mkspecs/win32-g++/qmake.conf
}

build() {

  cd ${srcdir}
  cd ${_basename}

  local _buildpkgdir=${pkgdirbase}/${pkgname}/${_qt5_prefix}
  mkdir -p ${_buildpkgdir}
  local QTDIR_WIN=$(cygpath -am ${_buildpkgdir})
  
  local _freetype2_pkgconf=""
  if [ "$_system_freetype" == "yes" ]; then
    _freetype2_pkgconf="freetype2"
  fi
  
  local -a _extra_incpaths=($(pkg_config_qt5 --cflags-only-I dbus-1 libxml-2.0 ${_freetype2_pkgconf}))
  _extra_incpaths+=("-I")
  _extra_incpaths+=("${MINGW_PREFIX}/include/mariadb")
  
# This *could* be used but we'd have to make sure it's correct for all variants first.
#  local -a _extra_libpaths=($(pkg_config_qt5 --libs-only-L dbus-1 libxml-2.0 freetype2))
#  local -a _extra_libs=($(pkg_config_qt5 --libs-only-l dbus-1 libxml-2.0 freetype2))
  local -a _extra_libpaths=()
  local -a _extra_libs=()

  export PATH="${srcdir}/${_basename}/qtbase/bin:${srcdir}/${_basename}/qtbase/lib:${PATH}"
  
  # Qt manages the compiler flags for release / debug configs separately, so having our own values (-O2) is harmful here ..
  unset CFLAGS
  unset CXXFLAGS
  unset LDFLAGS
  
  local -a configure_opts

  if [ "$_with_fontconfig" == "no" ]; then
    configure_opts+=("-no-fontconfig")
  fi
  if [ "$_with_openssl" == "no" ]; then
    configure_opts+=("-no-openssl")
  fi
  if [ "$_with_dbus" == "no" ]; then
    configure_opts+=("-no-dbus")
  fi
  if [ "$_system_freetype" == "yes" ]; then
    configure_opts+=("-system-freetype")
  fi
  if [ "$_system_harfbuzz" == "yes" ]; then
    configure_opts+=("-system-harfbuzz")
  else
    configure_opts+=("-qt-harfbuzz")
  fi
  if [ "$_system_libjpeg" == "no" ]; then
    configure_opts+=("-qt-libjpeg")
  fi
  if [ "$_system_libpng" == "no" ]; then
    configure_opts+=("-qt-libpng")
  fi
  if [ "$_system_zlib" == "no" ]; then
    configure_opts+=("-qt-zlib")
  fi
  if [ "$_system_pcre" == "no" ]; then
    configure_opts+=("-qt-pcre")
  fi
  if [ "$_with_icu" == "yes" ]; then
    configure_opts+=("-icu")
  else
    configure_opts+=("-no-icu")
  fi  
  if [ "$_build_examples" == "no" ]; then
    configure_opts+=("-nomake" "examples")
  fi
  if [ "$_build_tests" == "no" ]; then
    configure_opts+=("-nomake" "tests")
  fi
  if [ "$_build_tools" == "no" ]; then
    configure_opts+=("-skip" "qttools")
  fi

  ./configure.bat \
    -prefix ${QTDIR_WIN} \
    -datadir ${QTDIR_WIN}/share/qt5 \
    -archdatadir ${QTDIR_WIN}/share/qt5 \
    -examplesdir ${QTDIR_WIN}/share/qt5/examples \
    -testsdir ${QTDIR_WIN}/share/qt5/tests \
    -opengl ${_opengl_for_configure} \
    -opensource \
    -confirm-license \
    -platform win32-g++ \
    "${_build_mode}" \
    "${_extra_incpaths[@]}" \
    "${_extra_libpaths[@]}" \
    "${_extra_libs[@]}" \
    -no-iconv \
    "${_extra_config[@]}" \
    "${_sql_config[@]}" \
    "${configure_opts[@]}"

  make ${MAKEFLAGS}
}

package() {

  cd ${srcdir}
  cd ${_basename}

  export PATH=${pkgdir}${_qt5_prefix}/bin:${srcdir}/${_basename}/qtbase/bin:${srcdir}/${_basename}/qtbase/lib:${PATH}

  make install
  if [ "$_make_docs" == "yes" ]; then
    make docs
    make install_qch_docs
  fi

  install -D -m644 LGPL_EXCEPTION.txt "${pkgdir}${_qt5_prefix}"/share/licenses/qt5/LGPL_EXCEPTION.txt

  # Remove dll's from lib
  rm -f "${pkgdir}${_qt5_prefix}/lib"/*.dll

  # Workaround for installing empty .pc files
  plain "---> Fix pkgconfig files..."
  local _pc_files=( $(find ${srcdir}/${_basename} -type f -name Qt5*.pc) )
  cp -f ${_pc_files[@]} ${pkgdir}${_qt5_prefix}/lib/pkgconfig/
  
  # Fix paths in qconfig.pri and qmodule.pri:
  #   $(cygpath -m ${_qt5_prefix}) -> $(cygpath -m ${pkgdir}${_qt5_prefix})
  MINGW_PREFIX_WIN=$(cygpath -m ${_qt5_prefix})
  PKGDIR_MINGW_PREFIX_WIN=$(cygpath -m ${pkgdir}${_qt5_prefix})
  find "${pkgdir}${_qt5_prefix}/share/qt5" -type f -name '*.pri' \
    -exec sed -i -e "s|${MINGW_PREFIX_WIN}|${PKGDIR_MINGW_PREFIX_WIN}|g" {} \;
}

sha256sums=('609ab74b93ef11f24ef4d7c1bd0a2e81c4280b07fa455dfcf003a2364ab72745'  # 0001-oracle-driver-prompt.patch
            '1b3aace0abc6c1ab1d077a57f7b2b0b7772e63c5b61519b633e955bbbc6d5485'  # 0002-use-fbclient-instead-of-gds32.patch
            '12263a04ef371f5a934b43bef7b8607cb7aa8a6d6da69a75a5411da6d44368d6'  # 0003-use-mingw-built-mysql-library.patch
            '334e8f84b892e1bda5d71ec078d6e2a325d979f0d3ab454fe348594d1c039f84'  # 0005-syncqt-fix.patch
            'c01e095a624f8fb7527ac0a1f476d5b395c55a7abc8618d69c09c503caca86ea'  # 0006-win_flex-replace.patch
            '02d007a0a735f6b41e4feab7f0cc30a5bf8e55d413513177f9513eff0dfd55d8'  # 0007-win32-g-Enable-static-builds.patch
            'b21726bbd2ed34ad78e18d6b82a2c3b3c3e753ee2e978a5bb58b386f1f33ce41'  # 0008-win32-g-Add-QMAKE_EXTENSION_IMPORTLIB-defaulting-to-.patch
            '44dfc8b56be2d3f33bb7f67abd472a58380d22bc3532f3ecdabfb3dd108f4a77'  # 0011-win32-g++-allow-static-dbus-1.patch
            '193957a4fbd18cbe951dc11d836e1ff5d6ad07780643ef81e559d57f6672b028'  # 0012-compileTest-for-icu-after-setting-static-or-shared.patch
            '539653bcce49d1841aba70b5753407f4e3d2232db77fc75381a9182dec76defe'  # 0014-fix-configure-tests.patch
            '84945d2b47e05465af08094fefa743bff12f1d842ec0524b61ff789cd0f2d0e5'  # 0015-properly-split-libraries-mingw.patch
            '7a85c145e2053f8ac48defa50b31ec9745cca62ed87284662b2b4661b25376ab'  # 0016-win32-g++-use-qpa-genericunixfontdatabase.patch
            '8048fe32b4f4155b1616dbd68e6e2fa4e01e7e0916d64664be24e7f21329c3f2'  # 0017-fix-examples-building.patch
            '2c949e5fd0339892e5ea1253f233231c2e594783af517ae924b9b3c6799521da'  # 0024-icu-add-U_LIB_SUFFIX_C_NAME.patch
            'f3c5709803303cc411b8f4f0232cafa6f9b6b9c1f2d3791cb70415c6db0060b8'  # 0025-force-using-make-on-msys.patch
            '6893c83e4d26643a1cf5607a1a367401d27fec98440fa1d3685a8cf1478ddf92'  # 0030-workaround-ansidecl-h-PTR-define-conflict.patch
            '7f5e092a5062db776a96ab32758ff175c3689b79902f5d9656f31029c33f66dd'  # 0031-workaround-BOOL-define-conflict.patch
            '1ada266bc6cd033d770bc40ad879527db222563fc20cf98cf2848b84b2a0e503'  # 0034-Use-QMAKE_PREFIX_STATICLIB-in-create_cmake-prf.patch
            '27e9d402126d313ff647066207038578c26a3cf0f60833ae5d76157d53712eae'  # 0035-dont-add-resource-files-to-qmake-libs.patch
            '29f13f7b44476bebfc5280a8481fa24926185860476ed0fd05f6b5a959b801d8'  # 0036-win32-qt5-static-cmake-link-ws2_32-and--static.patch
            'c114d2df071b66e47f4bd43d335d48868fd5bcf9670f276b557edacd53fa92c0'  # 0037-Improve-cmake-plugin-detection-as-not-all-are-suffixed-Plugin.patch
            'b9939efea7792a960cdc9404a515c6f0a1cd42ffbdb018d52f2b0206fffe17f5'  # 0038-cmake-Rearrange-STATIC-vs-INTERFACE-targets.patch
            '3ae9d64fb683036b3b1f91036378791e1ec4a10205c59e78761d22d8479c0540'  # 0039-Make-it-possible-to-use-static-builds-of-Qt-with-CMa.patch
            'd720ac76035d56caea1f045dfb468a25865f9d4b22016cec5414f1c639a7697a'  # 0040-Generate-separated-libraries-in-prl-files-for-CMake.patch
            '914051840e01bf453e3db710d4471e6758e39e2cb87f8ffe3072fb90218c9f83'  # 0041-Fix-mingw-create_cmake-prl-file-has-no-lib-prefix.patch
            '9eb9366d81179883e09e180bcd6bba3452661879f993a7e48e4c86d8bb4720e6'  # 0042-static-cmake-also-link-plugins-and-plugin-deps.patch
            '29ed4566d4c1853b70a5173c6391ed90f123c5121b5836f2d16f8478f6354f0a'  # 0043-static-cmake-regex-QT_INSTALL_LIBS-in-QMAKE_PRL_LIBS_FOR_CMAKE.patch
            '72e46178f2f694d8408f22684d1a7d39394056cb574fc4855c1f38c9d51e7e6c'  # 0045-static-use-qminimal-platform-plugin-for-qcollectiongenerator.patch
            'fd6b1cd956730c1a05a7489760afed6b36561a3b0ec5857c3fbe21dcd7a54617'  # 0046-Revert-Revert-fix-NTFS-mount-points.patch
            '3bda25f357a33b122345fea011a14199b5953fd248fab960a5344a2ed9401331'  # 0048-win32-Avoid-platformNativeInterface-segfaults-with-minimal-platform.patch
            '199c08dbf2f1e8596023b484714de8757a8bcf7d78c5dfe64ea271c54a401687'  # 0049-do-not-include-qopengles2ext-h.patch
            )
